﻿using DocumentFormat.OpenXml.Lite.Helper;
using DocumentFormat.OpenXml.Lite.WordprocessingML.Word.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.WordprocessingML.Word.SectionProperties
{
    [XmlRoot("lnNumType", Namespace = Constants.WordMain)]
    public class LineNumberingSettings : XmlSerializable, ISectionPropElement
    {
        [Optional]
        [XmlAttribute("countBy", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> CountBy { get; set; }

        [Optional]
        [XmlAttribute("start", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Start { get; set; }

        [Optional]
        [XmlAttribute("distance", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Distance { get; set; }

        [Optional]
        [XmlAttribute("restart", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_LineNumberRestart> Restart { get; set; }

        public LineNumberingSettings() { }

        public void Copy(object obj)
        {
            if (obj is LineNumberingSettings)
            {
                this.CountBy = (obj as LineNumberingSettings).CountBy;
                this.Start = (obj as LineNumberingSettings).Start;
                this.Distance = (obj as LineNumberingSettings).Distance;
                this.Restart = (obj as LineNumberingSettings).Restart;
            }
        }
    }
}
